package cn.edu.scau.cmi.ema.controller;

import cn.edu.scau.cmi.ema.domain.Brand;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

@Controller
public class TestController {
    @RequestMapping("/testRestController")
    @ResponseBody
    public String testRestController(){
        return "Hello, ema";
    }

    @RequestMapping("/testController")
    public String testController(){
        return "test";
    }

    @RequestMapping("/testMaVController")
    public ModelAndView testMaVController(){
        ModelAndView modelAndView = new ModelAndView();

        Brand brand = new Brand();
        brand.setId(1);
        brand.setName("AMD");

        modelAndView.addObject("student", brand);
        modelAndView.setViewName("test");
        return modelAndView;
    }

}
